<%@page import="cn.hutool.extra.servlet.ServletUtil"%>
<%@ page language="java" pageEncoding="UTF-8"%><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>获取cookie</title>
	</head>
	<body>
		<pre><%
		Cookie[] cs = request.getCookies();
		if(cs==null){
			out.println("没有cookie");
		}else{
			for(Cookie c : cs){
				out.println(c.getName()+" = "+c.getValue());
			}
		}
		out.println("--------------------");
		//ServletUtil.getCookie 获得指定的Cookie
		if(ServletUtil.getCookie(request, "aa")!=null){
			out.println("aa="+ServletUtil.getCookie(request, "aa").getValue());
		}
		%></pre>
	</body>
</html>